Skip to content

test: power-cut tests for CoW, snapshots, clones and TRIM; fix orphan snapshot inode reports - #129

Merged
mattmattox merged 11 commits into
mainfrom
test/crash-injection-review
Nov 14, 2026
Merged

mattmattox merged 11 commits into
mainfrom
test/crash-injection-review

Conversation

@mattmattox

@mattmattox mattmattox commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Crash-injection review before release. A device write gate lets the first N writes of an operation land and refuses the rest, for every N. The image is then remounted in mount order (journal replay, then snapshot recovery). fsck may find only leaks, and repair must leave it clean. Acknowledged data and snapshots must be unchanged.

Operation Writes cut Result
CoW write to a snapshotted file 269 leaks only; each block old or new; snapshot unchanged
Snapshot create / delete 9 / 11 pass after the fix below
Clone 8 pass
Unlink with TRIM queued, then reuse and flush 11 no discard hits a used block (discards punch holes)
Torn last journal record n/a earlier records replay; recovery stops there

Under -race, at most 48 evenly spread cuts run per operation.

Fixed here. A snapshot or clone claimed an inode in one write and set its mode in a second, so a crash between them left a typeless inode, which fsck called an ERROR. The claim now writes the final fields. Phase 7 now marks a data inode with no snapshot as fixable, with wording true for create and delete, and marks it repaired when phase 8 frees it.

Found, fixed in #123. Journal recovery replayed a stale record from the previous mount or the previous lap in place of a lost record. The tests for it went to the journal fix, and main now has them.

TRIM review. I found no double free and no wrong-block discard.

VM. The shared disk now passes discard=unmap, so TRIM runs in every VM test. New power-failure tests cover a CoW loop, snapshot create/delete and TRIM reuse. The full 2-node suite on .66 passed 63/0 at 37dca71, before main's later changes such as the directory index (#127) were merged in.

🤖 Generated with Claude Code

mattmattox and others added 11 commits November 13, 2026 15:49
A write gate lets the first N device writes land and refuses the rest, for
every N of an operation; the image is then remounted with journal replay
and snapshot recovery, and fsck may find only leaks, which repair fixes.
A journal test loses the last sector of the last record. VM tests cut
power during copy-on-write, snapshot and TRIM workloads, with discard
passed through to the shared disk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s place

Commit writes the record, then the superblock with the new tail, with no
flush between them. If the superblock lands and the record does not, the
sector still holds a record from the previous mount or the previous lap,
with a valid checksum, and recovery replays it. Both tests fail until
recovery checks each record's generation and sequence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fsck free orphan data inodes

A snapshot or clone claimed an inode slot and wrote its mode in a second
write, so a crash between them left an inode with no file type, which fsck
reported as an error. The claim now writes the final mode and flags.

A crash while a snapshot is created or deleted can still leave its data
inode with no descriptor. Phase 7 now reports it as fixable, with wording
true for both, and marks it repaired when phase 8 frees the inode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… VM CoW test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ailure test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They fail until recovery checks each record's generation and sequence,
which the journal's own PR adds together with ed0b38e's tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…review

# Conflicts:
#	tests/vm/scripts/run-vm-tests.sh
A TRIM batch size of MaxInt32 preallocated 32 GB per manager, which the
race detector made resident. Under -race the harness now cuts power at
48 evenly spread writes instead of every write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…review

# Conflicts:
#	internal/goclusterfs/fs.go
#	tests/test-manifest.yaml
The operations a power cut interrupts discard their errors on purpose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit 0b81654 into main Nov 14, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant